#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
string s, temp;
int main()
{
	int t;
	cin >> t;
	while (t--) {
		cin >> s;
		temp = s;
		reverse(s.begin(), s.end());
		cout << s << temp << endl;
	}
	return 0;
}